﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../jquery.min.js"></script>
	<script type="text/javascript" src="../jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../extend.js"></script>
    <script>
        var dataCache = null;
        var appId = GetQueryString("moduleid");
        window.onresize=calSize;
        $(document).ready(function(){
            showMask();
            $.get("../../api/information/version",function(response){
                if(response.Result==0){
                    dataCache = JSON.parse(response.Data);
                    initVal();
                }else{
                    $.messager.alert("错误",response.Message,"error");
                }
            },"json")
            .error(function(){
                $.messager.alert("错误","系统内部错误","error");
            })
            .complete(function() { 
                hideMask();
            });
            calSize();

		});
        function calSize(){
            var height=window.parent.document.getElementById("mainFrame").clientHeight;
            var width=window.parent.document.getElementById("mainFrame").clientWidth;
            window.parent.document.getElementById(appId).height = height-35;
            $("#editZone").panel({height:height-80,width:width-20});
            $("#toolbar").panel({width:width-20});
        }
        function initVal(){
            $("#AutoId").val(dataCache.AutoId);
            $("#Flag").val(dataCache.Flag);
            $("#Company").textbox("setValue",dataCache.Company);
            $("#Address").textbox("setValue",dataCache.Address);
            $("#License").textbox("setValue",dataCache.License);
            $("#Note").textbox("setValue",dataCache.Note);
            $("#Version").textbox("setValue",dataCache.Version);
            $("#Upgrade").textbox("setValue",dataCache.Upgrade);
            $("#Patch").textbox("setValue",dataCache.Patch);
        }
        function submitChange() {
            if (dataCache == null) {
                $.messager.alert("错误", "无法获取被编辑的对象", "error");
                return;
            }
            showMask();
            dataCache.Flag = $("#Flag").val();
            dataCache.Company=$("#Company").textbox("getValue");
            dataCache.Address=$("#Address").textbox("getValue");
            dataCache.License=$("#License").textbox("getValue");
            dataCache.Note=$("#Note").textbox("getValue");
            dataCache.Version=$("#Version").textbox("getValue");
            dataCache.Upgrade=$("#Upgrade").textbox("getValue");
            dataCache.Patch = $("#Patch").textbox("getValue");
            $.post("../../api/information/update",dataCache,function(response){
                if(response.Result==0){
                    dataCache = JSON.parse(response.Data);
                    initVal();
                    $.messager.alert("信息","操作成功","info");
                }else{
                    $.messager.alert("错误",response.Message,"error");
                }
            })
            .error(function(){
                $.messager.alert("错误","系统内部错误","error");
            })
            .complete(function() { 
                hideMask();
            });
        }
    </script>
<head>
<body>
	<div id="toolbar" class="easyui-panel" style="padding:1px">
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true,disabled:true">新建</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:submitChange,iconCls:'icon-save',plain:true">保存</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:initVal,iconCls:'icon-no',plain:true">取消</a>
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true,disabled:true">搜索</a>
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true,disabled:true">审核</a>
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-back',plain:true,disabled:true">反审</a>
    </div>
    <div style="margin:2px"></div>
    <div id="editZone" class="easyui-panel" style="padding:10px;">
        <table>
            <tr>
                <td><input class="easyui-textbox" id="Company"  style="width:400px" data-options="label:'公司:',required:true"></td>
                <td>&nbsp;</td>
                <td><input class="easyui-textbox" id="Address"  style="width:400px" data-options="label:'地址:'"></td>
            </tr>
            <tr>
                <td><input class="easyui-textbox" id="License" style="width:400px" data-options="label:'授权密钥:'"></td>
                <td>&nbsp;</td>
                <td><input class="easyui-textbox" id="Note"  style="width:400px" data-options="label:'备注:'"></td>
            </tr>
            <tr>
                <td><input class="easyui-textbox" id="Version" style="width:400px" data-options="label:'版本号:'"></td>
                <td>&nbsp;</td>
                <td><input class="easyui-textbox" id="Upgrade" style="width:400px" data-options="label:'小版号:'"></td>
            </tr>
            <tr>
                <td><input class="easyui-textbox" id="Patch" style="width:400px" data-options="label:'补丁号:'"></td>
                <td>&nbsp;</td>
                <td></td>
            </tr>
        </table>

    </div>
    <div hidden>
        <p id="AutoId"></p>
        <p id="Flag"></p>
    </div>
</body>
</html>